package monster.flight.comm.util.timer;

import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.Map;

import monster.comm.util.DateUtil;
import monster.comm.util.SpringApplicationContextFactory;
import monster.flight.admin.manager.service.admin.Flight_infoService;
import monster.flight.comm.util.FlightFactory;

public class queryFlight {
   public void execute() {
	   try{
		   String flight_date = DateUtil.getDate("yyyy-MM-dd");
		   FlightFactory flightFactory= FlightFactory.getInstatnce();
		   flightFactory.addFlight(flight_date);
		   Flight_infoService  flight_infoService =(Flight_infoService) SpringApplicationContextFactory.getService("flight_infoService");
		   Map<String,WeakReference<String>> map  = flightFactory.getFlight();
		   for(Iterator<WeakReference<String>> it = map.values().iterator();it.hasNext();){
			   WeakReference<String> fd = it.next(); 
			   if(fd!=null){
				   if(fd.get()!=null)
				     flight_infoService.fill(fd.get());
			   }
			  
		   }	   
		   
	   }catch(Exception e){
		   e.printStackTrace();
	   }
   }
}
